#!/bin/sh
# get SSID and local IP if connected otherwise 'down'

# requires root privileges
ssid_ip="$(sudo wpa_cli status \
                  | sed -n '4s/^ssid=//p;11s/^ip_address=//p' \
                  | tr '\n' ' ' \
         )"
# remove single trailing whitespace
ssid_ip="${ssid_ip%\ }"

echo "${ssid_ip:=down}"
